<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HTML大作业2-排行榜</title>
    <link rel="stylesheet" href="./styles/style.css">
</head>



<style>


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f5f5f5;
}

/* 顶部标题栏 */
.header {
    background-color: #d23e34;
    color: #fff;
    padding: 15px;
    text-align: center;
}

.header h1 {
    font-size: 20px;
    margin-bottom: 10px;
}

.tab-group {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.tab {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
}

.tab.active {
    background-color: #fff;
    color: #d23e34;
    font-weight: bold;
}

/* 文章分类标签 */
.article-tag {
    background-color: #d23e34;
    color: #fff;
    font-size: 12px;
    padding: 5px 10px;
    width: fit-content;
    margin: 10px;
    border-radius: 3px;
}

/* 排行榜列表 */
.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 0 10px 15px;
}

.ranking-item {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.cover-img {
    width: 100%;
    height: auto;
    display: block;
}

.rank-badge {
    position: absolute;
    background-color: #ff5722;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 0 0 8px 0;
}

.ranking-item {
    position: relative;
}

.title {
    font-size: 16px;
    padding: 10px;
    color: #333;
}

.tag {
    font-size: 12px;
    color: #d23e34;
    padding: 0 10px 5px;
}

.meta {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    padding: 0 10px 10px;
    font-size: 13px;
    color: #666;
}

.meta img {
    width: 16px;
    vertical-align: middle;
    margin-right: 3px;
}




</style>
<body>
    <!-- 顶部标题栏 -->
    <header class="header">
        <h1>排行榜</h1>
        <div class="tab-group">
            <button class="tab active">好文精选</button>
            <button class="tab">热门资讯</button>
        </div>
    </header>

    <!-- 文章分类标签 -->
    <div class="article-tag">文章</div>

    <!-- 排行榜列表 -->
    <main class="ranking-list">
        <!-- TOP1 -->
        <article class="ranking-item">
            <div class="rank-badge">TOP1</div>
            <img src="./imgs/cover1.jpg" alt="安卓电视通过KODI看IPTV" class="cover-img">
            <h3 class="title">安卓电视通过 KODI 看 IPTV</h3>
            <div class="meta">
                <span class="comment">
                    <img src="./imgs/comment.png" alt="评论"> 105
                </span>
                <span class="like">
                    <img src="./imgs/like.png" alt="点赞"> 345
                </span>
            </div>
        </article>

        <!-- TOP2 -->
        <article class="ranking-item">
            <div class="rank-badge">TOP2</div>
            <img src="./imgs/cover2.jpg" alt="5km跑步技巧" class="cover-img">
            <h3 class="title">起跑线26期：5km跑步，你到了哪一级别？学会这几个跑步技巧，助你提升PB</h3>
            <div class="tag">#跑者</div>
            <div class="meta">
                <span class="comment">
                    <img src="./imgs/comment.png" alt="评论"> 151
                </span>
                <span class="like">
                    <img src="./imgs/like.png" alt="点赞"> 132
                </span>
            </div>
        </article>

        <!-- TOP3 -->
        <article class="ranking-item">
            <div class="rank-badge">TOP3</div>
            <img src="./imgs/cover3.jpg" alt="百度AI新功能" class="cover-img">
            <h3 class="title">百度AI新功能实测：文生图支持4K分辨率，生成速度比之前快了50%</h3>
            <div class="tag">#AI技术 #科技资讯</div>
            <div class="meta">
                <span class="comment">
                    <img src="./imgs/comment.png" alt="评论"> 98
                </span>
                <span class="like">
                    <img src="./imgs/like.png" alt="点赞"> 207
                </span>
            </div>
        </article>
    </main>

    <!-- 标签切换交互脚本 -->
    <script>
        const tabs = document.querySelectorAll('.tab');
        tabs.forEach(tab => {
            tab.addEventListener('click', () => {
                tabs.forEach(t => t.classList.remove('active'));
                tab.classList.add('active');
                // 可在此处添加标签切换时的内容变化逻辑
            });
        });
    </script>
</body>
</html>